package leecodeHot100.hash;

import java.util.HashSet;
import java.util.Set;

public class LongestContinuousSequence {
    public static void main(String[] args) {
        Set<Integer> set = new HashSet<>();
        int[] arr = {100,4,200,1,3,4,2};
        for (int i : arr) {
            set.add(i);
        }
        int max = 0;
        for (int num : set) {
            if(!set.contains(num-1)){
                int currentNum = num;
                int currentStreak = 1;
                while(set.contains(currentNum+1)){
                    currentNum++;
                    currentStreak++;
                }
                max = Math.max(max,currentStreak);
            }
        }
        System.out.println(max);
    }
}
